package com.benben.springSecurity.service.impl;

import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

@Service
public class EceturtorServiceImpl {


    public void testEceturtor() {
        for(int i = 0; i < 10; i++){
            oneEceturtor(i);
            System.out.println("第"+i+"个线程创建成功");
        }
    }

    @Async("creatEcecutor")
    public void oneEceturtor(int i){
        try {
            System.out.println("第" + i +"个线程执行开始");
            Thread.sleep(1000);
            System.out.println("第" + i +"个线程执行结束");
            System.out.println("当前线程："+ Thread.currentThread().getName());
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

    }
}
